package top.ezzz.config;

import cn.hutool.extra.mail.MailAccount;

import java.util.Properties;

public class MailConfig {


    public static class ReceiveAccount {

        public static String host = "pop.qq.com";
        public static int port = 995;
        public static String protocol = "pop3";

        public static String username = "shenmingkai@foxmail.com";
        public static String password = "crpemhunxnixihji";
        public static int receiveCount = 3;


        public static Properties getAccount() {
            Properties receiveAccount = new Properties();
            receiveAccount.setProperty("mail.store.protocol", protocol); // 使用POP3协议
            receiveAccount.setProperty("mail.pop3.host", host); // POP3服务器地址
            receiveAccount.setProperty("mail.pop3.port", String.valueOf(port));// 端口
            receiveAccount.setProperty("mail.pop3.ssl.enable", "true"); // 启用SSL
            return receiveAccount;
        }

    }

    public static class SendAccount {
        public static String username = "shenmingkai@foxmail.com";
        public static String password = "crpemhunxnixihji";
        public static String host = "smtp.qq.com";
        public static int port = 465;

        public static MailAccount getAccount() {
            MailAccount sendAccount = new MailAccount();
            sendAccount.setHost(host);
            sendAccount.setPort(port);
            sendAccount.setAuth(true);
            sendAccount.setSslEnable(true);
            sendAccount.setFrom(username);
            sendAccount.setUser(username);
            sendAccount.setPass(password);
            return sendAccount;
        }
    }
}
